package com.zzq.demo.actable.runner;

import com.zzq.demo.actable.entity.TtModel;
import com.zzq.demo.actable.mapper.TtModelMapper;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : zhaoziqian
 * @description :
 * @date : 2019/9/12 10:23
 */
//@Order(99)
//@Component
public class StartUpRunner implements CommandLineRunner {

    @Resource
    private TtModelMapper ttModelMapper;

    @Override
    public void run(String... args) throws Exception {
        List<TtModel> models = ttModelMapper.selectAll();
        for (TtModel model : models) {
            model.setName(model.getNum() + "tetstststst");
            ttModelMapper.updateByPrimaryKey(model);
        }
    }
}
